-- Decompiled with the Synapse X Luau decompiler.

local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, CommonOHOH.files.GameObject());
function M.new(self)
	assert(self, "param model is nil");
	return M(self);
end;
function M.ctor(self, p3)
	M.super.ctor(self, p3);
	self.__scale = 1;
	self.__org_att = {};
	self.__org_size = {};
	self:GetRootPart_Check();
end;
function M.dtor(self)
	M.super.dtor(self);
end;

function M.GetRootPart(self, p6)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	if self.root_part then
		return self.root_part;
	end;
	local v2 = p6 or CommonOHOH:GetDefaultTimeLimit();
	while not self.main_inst.PrimaryPart do
		v2 = v2 - wait();
		if v2 <= 0 then
			warn("model " .. self.main_inst.Name .. " wait complete time out,please check!");
			return;
		end;	
	end;
	self.root_part = self.main_inst.PrimaryPart;
	return self.root_part;
end;
function M.GetRootPart_Check(self, p8)
	local v3 = self:GetRootPart();
	assert(v3, "get root part faild");
	return v3;
end;
function M.GetRootPart_Loop(self, p10)
	local v4 = self:GetRootPart(p10);
	if v4 then
		return v4;
	end;
	return self:GetRootPart_Loop(p10);
end;
function M.GetCenterCFrame(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	local v5, v6 = self.main_inst:GetBoundingBox();
	return v5;
end;
function M.Ration(self,x,y,z)
	local oldcf=self:GetCFrame()
	local cf=oldcf*CFrame.Angles(math.rad(x), math.rad(y), math.rad(z))
	self:SetCFrame(cf)
end
function M.SetCenterCFrame(self, p13)
	assert(p13, "param cframe is nil");
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	local v7 = self:GetPosition();
	self:SetCFrame(CFrame.new(v7, v7 + p13.LookVector));
	self:SetCenterPosition(p13.Position);
end;
function M.GetPosition(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	return self:GetRootPart().Position;
end;
function M.SetPosition(self, p16)
	assert(p16, "param position is nil");
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	self.main_inst:TranslateBy(p16 - self:GetPosition());
end;
function M.GetCenterPosition(self)
	return self:GetCenterCFrame().Position;
end;
function M.SetCenterPosition(self, p19)
	assert(p19, "param position is nil");
	self:SetPosition(p19 + (self:GetPosition() - self:GetCenterPosition()));
end;
function M.GetPosition2D(self)
	local v8 = self:GetPosition();
	return Vector2.new(v8.X, v8.Z);
end;
function M.SetPosition2D(self, p22)
	assert(p22, "param position 2d is nil");
	self:SetPosition(Vector3.new(p22.X, self:GetPosition().Y, p22.Z));
end;
function M.TranslateBy(self, p24)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	self.main_inst:TranslateBy(p24);
end;
function M.TryMoveTo(self, p26)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	self.main_inst:MoveTo(p26);
end;

function M.MoveTo(self, pos)
	self.main_inst:MoveTo(pos);
end
function M.GetCFrame(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	return self.main_inst:GetPrimaryPartCFrame();
end;

function M.SetLookAt(self, look)
	assert(look, "param look is nil");
	self:SetCFrame(CFrame.new(self:GetPosition(),look))
end
function M.SetCFrame(self, p29)
	assert(p29, "param cframe is nil");
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	self.main_inst:SetPrimaryPartCFrame(p29);
end;
function M.DistanceToModelObject(self, p31)
	assert(p31, "param model object is nil");
	return (self:GetPosition() - p31:GetPosition()).Magnitude;
end;
function M.DistanceToPosition(self, p33)
	assert(p33, "param position is nil");
	return (self:GetPosition() - p33).Magnitude;
end;
function M.DistanceToPosition2D(self, p35)
	assert(p35, "param position is nil");
	local v9 = self:GetPosition();
	return (Vector2.new(v9.X, v9.Z) - Vector2.new(p35.X, p35.Z)).Magnitude;
end;
function M.DistanceToModelObject2D(self, p37)
	assert(p37, "param model object is nil");
	local v10 = self:GetPosition();
	local v11 = p37:GetPosition();
	return (Vector2.new(v10.X, v10.Z) - Vector2.new(v11.X, v11.Z)).Magnitude;
end;
function M.GetExtentsSize(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	return self.main_inst:GetExtentsSize();
end;
function M.BreakJoints(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	self.main_inst:BreakJoints();
end;
function M.GetBoundingBox(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	return self.main_inst:GetBoundingBox();
end;
function M.GetExtentsRadius2D(self)
	local v12 = self:GetExtentsSize();
	return (v12.X + v12.Z) / 4;
end;
function M.SetNetworkOwner(self, player)
	--warn("-------SetNetworkOwner--------",player)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	local owner = player and player.main_inst;
	if not self.main_inst.Parent then
		self:AddHandleOnInWorkspace(self.SetNetworkOwner, true, player);
		return;
	end;
	for _, v in ipairs(self.main_inst:GetDescendants()) do
		if v:IsA("BasePart") then
			v.Anchored = false;
			v:SetNetworkOwner(owner);
		end;
	end;
	
	self:AddHandleOnChildAdd(self.SetNetworkOwner, true, player);

end;
function M.GetMass(self)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	local v16 = 0;
	for v17, v18 in ipairs(self.main_inst:GetDescendants()) do
		if v18:IsA("BasePart") then
			v16 = v16 + v18:GetMass();
		end;
	end;
	return v16;
end;
function M.SetCanCollide(self, p46)
	assert(self.main_inst, "object main inst is nil class name = " .. self.class);
	if p46 == nil then
		p46 = false;
	end;
	for v19, v20 in ipairs(self.main_inst:GetDescendants()) do
		if v20:IsA("BasePart") then
			v20.CanCollide = p46;
		end;
	end;
end;
function M.GetPosDir2D(self, p48)
	local v21 = self:GetPosition();
	return Vector3.new(p48.X - v21.X, 0, p48.Z - v21.Z).Unit;
end;
function M.SetScale(self, p50)
	self.__scale = p50;
	local v22 = self:GetRootPart_Check();
	local l____org_att__23 = self.__org_att;
	local l____org_size__24 = self.__org_size;
	for v25, v26 in ipairs(self.main_inst:GetDescendants()) do
		if v26:IsA("BasePart") then
			local v27 = l____org_att__23[v26];
			if not v27 then
				v27 = Instance.new("Attachment", v22);
				v27.Name = "__org_size";
				v27.WorldPosition = v26.Position;
				v27:SetAttribute("size", v26.Size);
				l____org_att__23[v26] = v27;
			end;
			v26.Size = v27:GetAttribute("size") * p50;
			v26.Position = v22.Position:Lerp(v27.WorldPosition, p50);
		elseif v26:IsA("FileMesh") and v26.MeshId and v26.MeshId ~= "" then
			local v28 = l____org_size__24[v26];
			if not v28 then
				v28 = Instance.new("Vector3Value", v22);
				v28.Name = "__org_scale";
				v28.Value = v26.Scale;
				l____org_size__24[v26] = v28;
			end;
			v26.Scale = v28.Value * p50;
		end;
	end;
	self:SetCenterPosition((self:GetCenterPosition()));
end;
function M.ScaleToSize(self, p52)
	local v29 = math.min(p52.X, p52.Y, p52.X);
	local v30 = self:GetExtentsSize() / self:GetScale();
	self:SetScale(v29 / math.max(v30.X, v30.Y, v30.Z));
end;
function M.GetScale(self)
	return self.__scale;
end;
function M.SetTransparency(self, p55)
	
	self.transparencyData={}
	for v31, v32 in ipairs(self.main_inst:GetDescendants()) do
		if v32:IsA("BasePart") then
			if v32.Transparency<p55  then
				self.transparencyData[v32]=v32.Transparency
				v32.Transparency = p55;
			end

		end;
	end;
end;

function M.recoverTransparency(self, p55)
	if not self.transparencyData then
		return
	end
	for v31, v32 in ipairs(self.main_inst:GetDescendants()) do
		if v32:IsA("BasePart") and self.transparencyData[v32]  then
			v32.Transparency = self.transparencyData[v32];
		end;
	end;
	
	self.transparencyData=nil
end;


return M;
